package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.ActivityJoiner;
import com.ruoyi.swimming.domian.SwimmingTicketTimes;
import com.ruoyi.swimming.mapper.ActivityJoinerMapper;
import com.ruoyi.swimming.mapper.SwimmingTicketTimesMapper;
import com.ruoyi.swimming.service.ISwimmingTicketTimesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 泳票次数Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class SwimmingTicketTimesServiceImpl extends ServiceImpl<SwimmingTicketTimesMapper, SwimmingTicketTimes> implements ISwimmingTicketTimesService
{
    @Autowired
    private SwimmingTicketTimesMapper swimmingTicketTimesMapper;

    /**
     * 查询泳票次数
     * 
     * @param id 泳票次数ID
     * @return 泳票次数
     */
    @Override
    public SwimmingTicketTimes selectSwimmingTicketTimesById(Long id)
    {
        return swimmingTicketTimesMapper.selectSwimmingTicketTimesById(id);
    }

    /**
     * 查询泳票次数列表
     * 
     * @param swimmingTicketTimes 泳票次数
     * @return 泳票次数
     */
    @Override
    public List<SwimmingTicketTimes> selectSwimmingTicketTimesList(SwimmingTicketTimes swimmingTicketTimes)
    {
        return swimmingTicketTimesMapper.selectSwimmingTicketTimesList(swimmingTicketTimes);
    }

    /**
     * 新增泳票次数
     * 
     * @param swimmingTicketTimes 泳票次数
     * @return 结果
     */
    @Override
    public int insertSwimmingTicketTimes(SwimmingTicketTimes swimmingTicketTimes)
    {
        swimmingTicketTimes.setCreateTime(DateUtils.getNowDate());
        return swimmingTicketTimesMapper.insert(swimmingTicketTimes);
    }

    /**
     * 修改泳票次数
     * 
     * @param swimmingTicketTimes 泳票次数
     * @return 结果
     */
    @Override
    public int updateSwimmingTicketTimes(SwimmingTicketTimes swimmingTicketTimes)
    {
        swimmingTicketTimes.setUpdateTime(DateUtils.getNowDate());
        return swimmingTicketTimesMapper.updateById(swimmingTicketTimes);
    }

    /**
     * 批量删除泳票次数
     * 
     * @param ids 需要删除的泳票次数ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketTimesByIds(Long[] ids)
    {
        return swimmingTicketTimesMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除泳票次数信息
     * 
     * @param id 泳票次数ID
     * @return 结果
     */
    @Override
    public int deleteSwimmingTicketTimesById(Long id)
    {
        return swimmingTicketTimesMapper.deleteById(id);
    }
}
